package com.ruoyi.yun.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yun.domain.YunCoufigPfmconfig;
import com.ruoyi.yun.service.IYunCoufigPfmconfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 平台配置列Controller
 * 
 * @author ruoyi
 * @date 2023-10-24
 */
@RestController
@RequestMapping("/yun/pfmconfig")
public class YunCoufigPfmconfigController extends BaseController
{
    @Autowired
    private IYunCoufigPfmconfigService yunCoufigPfmconfigService;

    /**
     * 查询平台配置列列表
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(YunCoufigPfmconfig yunCoufigPfmconfig)
    {
        startPage();
        List<YunCoufigPfmconfig> list = yunCoufigPfmconfigService.selectYunCoufigPfmconfigList(yunCoufigPfmconfig);
        return getDataTable(list);
    }

    /**
     * 导出平台配置列列表
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:export')")
    @Log(title = "平台配置列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YunCoufigPfmconfig yunCoufigPfmconfig)
    {
        List<YunCoufigPfmconfig> list = yunCoufigPfmconfigService.selectYunCoufigPfmconfigList(yunCoufigPfmconfig);
        ExcelUtil<YunCoufigPfmconfig> util = new ExcelUtil<YunCoufigPfmconfig>(YunCoufigPfmconfig.class);
        util.exportExcel(response, list, "平台配置列数据");
    }

    /**
     * 获取平台配置列详细信息
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yunCoufigPfmconfigService.selectYunCoufigPfmconfigById(id));
    }

    /**
     * 新增平台配置列
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:add')")
    @Log(title = "平台配置列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YunCoufigPfmconfig yunCoufigPfmconfig)
    {
        return toAjax(yunCoufigPfmconfigService.insertYunCoufigPfmconfig(yunCoufigPfmconfig));
    }

    /**
     * 修改平台配置列
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:edit')")
    @Log(title = "平台配置列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YunCoufigPfmconfig yunCoufigPfmconfig)
    {
        return toAjax(yunCoufigPfmconfigService.updateYunCoufigPfmconfig(yunCoufigPfmconfig));
    }

    /**
     * 删除平台配置列
     */
    @PreAuthorize("@ss.hasPermi('yun:pfmconfig:remove')")
    @Log(title = "平台配置列", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yunCoufigPfmconfigService.deleteYunCoufigPfmconfigByIds(ids));
    }
}
